<template>
  <div class="courier-html">
    <div class="vue-head">
      <easy-head  :headName="headName" :returnUrl="returnUrl"></easy-head>
    </div>
    <div class="courier-class">
      <!--填写地址-->
      <div v-if="htmlData===0">
        <div class="courier-type">
          <div :class="courierType===0?'selectCourierType':''" @click="selectType(0)">寄快递</div>
          <div :class="courierType===1?'selectCourierType':''" @click="selectType(1)">领快递</div>
        </div>
        <div class="adress-class">
          <div class="first-class">
            <div v-if="courierType===0"
                 style="width: 100%;text-align: center;font-size: 0.5rem;margin-top: 1%;color: red">
              发货地址
            </div>
            <div v-if="courierType===1"
                 style="width: 100%;text-align: center;font-size: 0.5rem;margin-top: 1%;color: red">
              领快递地址
            </div>
            <div class="first-data">
              <div>
                <div>
                  <span>姓名</span></div>
                <div>
                  <span><input v-model="addressOne.name" type="text" maxlength="10" placeholder="请输入发件人姓名"></span></div>

              </div>
              <div>
                <div>
                  <span>手机号码</span></div>
                <div>
                  <span><input v-model="addressOne.phone" type="text" maxlength="11" placeholder="请输入11位手机号码"></span>
                </div>
              </div>
              <div v-if="this.courierType===1">
                <div>
                  <span>快递单号</span></div>
                <div>
                  <span><input type="text" placeholder="请输入快递单号"></span></div>
              </div>

              <div>
                <div>
                  <span>指定快递</span></div>
                <div>
                <span>
                  <select name="city" lay-verify=""
                          style=";border: solid 0.02rem #cccccc;width: 5rem;margin-top: -0.18rem;">
                  <option selected="selected" value="0">选填快递（可不填）</option>
                  <option value="0">顺丰</option>
                  <option value="0">圆通</option>
                  <option value="0">中通</option>
                  <option value="0">百世</option>
                  <option value="0">韵达</option>
                  <option value="0">ESM</option>

                </select></span></div>
              </div>
              <div style="height:3.2rem;border: none">
                <div>
                  <span>地址</span></div>
                <div style="height: 2rem;width: 70%;line-height: 1rem">
                <span><textarea cols="25" v-model="addressOne.address"
                                style="width: 100%;;border: 0.02rem solid #b6b6b6;margin-top: 3%;height: 1.7rem;font-size: 0.4rem;"
                                warp="soft" placeholder="请输入发货地址"></textarea></span></div>
                <div class="address-use" @click="htmlDataFc(0)">
                  使用历史地址
                </div>

              </div>

            </div>
          </div>
          <div class="first-class">
            <div style="width: 100%;text-align: center;font-size: 0.5rem;margin-top: 1%;color: red">
              送至
            </div>
            <div class="first-data">
              <div>
                <div>
                  <span>姓名</span></div>
                <div>
                  <span><input type="text" v-model="addressTwo.name" maxlength="10" placeholder="请输入发件人姓名"></span></div>
              </div>
              <div>
                <div>
                  <span>手机号码</span></div>
                <div>
                  <span><input type="text" v-model="addressTwo.phone" maxlength="11" placeholder="请输入11位手机号码"></span>
                </div>
              </div>
              <div>
                <div>
                  <span>指定快递</span></div>
                <div>
                <span>
                  <select name="city" lay-verify=""
                          style=";border: solid 0.02rem #cccccc;width: 5rem;margin-top: -0.18rem;">
                  <option selected="selected" value="0">选填快递（可不填）</option>
                  <option value="0">顺丰</option>
                  <option value="0">圆通</option>
                  <option value="0">中通</option>
                  <option value="0">百世</option>
                  <option value="0">韵达</option>
                  <option value="0">ESM</option>

                </select></span></div>
              </div>
              <div style="height:3.2rem;">
                <div>
                  <span>地址</span></div>
                <div style="height: 2rem;width: 70%;line-height: 1rem">
                <span><textarea cols="25" v-model="addressTwo.address"
                                style="width: 100%;;border: 0.02rem solid #b6b6b6;margin-top: 3%;height: 1.7rem;font-size: 0.4rem;"
                                warp="soft" placeholder="请输入发货地址"></textarea></span></div>
                <div class="address-use" @click="htmlDataFc(1)">
                  使用历史地址
                </div>

              </div>

            </div>
          </div>

        </div>
        <div style="width: 80%;text-align: center;margin-left: 10%">
          <button v-if="courierType===0" type="button" class="layui-btn">确认订单(来回跑腿[3元]+快递[寄出再付])</button>
          <button v-if="courierType===1" type="button" class="layui-btn">确认订单(跑腿[1.5元])</button>

        </div>

      </div>
      <!--是使用或者添加-->
      <div v-if="htmlData===1">
        <div class="use-address">
          <span>姓名：袁德旭&nbsp;&nbsp;&nbsp;</span><span>手机号码：18778772464</span>
          <div>
            <span>广东省深圳市宝安区松岗街道洋勇工业区三路三号B洞5楼</span>
          </div>
          <div style="width: 100%;text-align: center;margin-top: 0.2rem">
            <button type="button" class="layui-btn" @click="useAddress(adressOT)">使用该地址</button>
            <button type="button" class="layui-btn">删除该地址</button>
          </div>
        </div>

        <div class="use-address">
          <span>姓名：袁德旭&nbsp;&nbsp;&nbsp;</span><span>手机号码：18778772464</span>
          <div>
            <span>广东省深圳市宝安区松岗街道洋勇工业区三路三号B洞5楼</span>
          </div>
          <div style="width: 100%;text-align: center;margin-top: 0.2rem">
            <button type="button" class="layui-btn" @click="useAddress(adressOT)">使用该地址</button>
            <button type="button" class="layui-btn">删除该地址</button>
          </div>
        </div>

      </div>
    </div>

  </div>
</template>

<script>
  import easyHead from "../easyHead/easyHead"

  export default {
    name: "courierservice",
    components: {
      easyHead,
    },
    data() {
      return {
        htmlData: 0,
        returnUrl: "/index",
        headName: "快递下单",
        courierType: 0,
        addressOne: {name: "", phone: "", address: ""},
        addressTwo: {name: "", phone: "", address: ""},
        adressOT: 0,
      }
    },
    methods: {

      //选择地址1 2
      htmlDataFc(type) {
        this.htmlData = 1
        if (type === 0) {
          this.adressOT = 0
        } else {
          this.adressOT = 1
        }

      },
      //快递类型
      selectType(type) {
        this.courierType = type;
      },
      useAddress(type) {

        if (type === 0) {
          this.addressOne = {
            name: "袁佳慧",
            phone: "18778772464",
            address: "广东省深圳市宝安区松岗街道洋勇工业区三路三号B洞5楼409",
          }
        }
        else {
          this.addressTwo = {
            name: "周芝妮",
            phone: "18778772464",
            address: "广西省桂林市师范大学209",
          }
        }
        this.htmlData=0

      }
    }
  }
</script>

<style scoped>
  .use-address {
    width: 100%;
    height: 3.2rem;
    border: 0.02rem solid blue;
    font-size: 0.5rem;
    line-height: 0.65rem;
  }

  .address-use {
    text-align: right;
    color: blue;
    border-bottom: 0.02rem solid blue;
    width: 100%;
  }

  .first-data > div > :first-child {
    text-align: left;
    width: 25%;
  }

  .first-data > div > div {
    float: left;
  }

  .first-data > div {
    width: 90%;
    margin-left: 5%;
    height: 1rem;
    border-bottom: solid 0.02rem #cccccc;
    line-height: 1rem;
    font-size: 0.5rem;
    color: #6d6d72;
  }

  .adress-class {
    width: 100%;
    height: 70%;
    margin-top: 2%;
  }

  .selectCourierType {
    background-color: yellow;
  }

  .courier-type > div {
    width: 30%;
    line-height: 1rem;
    float: left;
    margin-left: 13%;
    border: solid 1px #b6b6b6;
    text-align: center;
    border-radius: 0.05rem;
  }

  .courier-type {
    width: 100%;
    height: 1rem;
    font-size: 0.5rem;
    font-family: 微软雅黑;
    color: #ff751d;
    margin-top: 1%;
  }

  .courier-class {
    border: solid 1px green;
    height: 20rem;
    width: 100%;
  }
</style>
